package com.kefu.boss.service;

import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
import com.kefu.boss.mapper.BossRoleMenuMapper;
import com.kefu.boss.model.BossRoleMenu;
import com.kefu.common.service.AbstractKefuService;
import com.kefu.sys.mapper.SysRoleMenuMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class BossRoleMenuService extends AbstractKefuService<BossRoleMenu> {
    @Resource
    protected BossRoleMenuMapper bossRoleMenuMapper;
    DefaultIdentifierGenerator generator = new DefaultIdentifierGenerator();

    public void batchAdd(List<BossRoleMenu> bossRoleMenus) {
        bossRoleMenus.stream().forEach(menu->{
            menu.setId(generator.nextId(menu));
        });
        bossRoleMenuMapper.batchAdd(bossRoleMenus);
    }

    public void deleteByRoleId(String roleId) {
        bossRoleMenuMapper.deleteByRoleId(roleId);
    }
}
